<% form_for :inproduct,:url => inproducts_path do |f| -%>
 <%= hidden_field_tag :f_store_id,params[:f_store_id] %>
  <% i=1 %>
	<%  for enum in  0..@products.length-1 %> 

		<% fields_for "inproducts[]",@products[enum] do |form| %>
	
	<tr>
		<% if @products[enum].category.products.length >= 1 && i == 1 %>
			<%= "<td style='text-align: left;' rowspan='#{@products[enum].category.products.length}'>#{@products[enum].category.name}</td>" %>

		<% end %>

		
		 <td style="text-align: left;"><%#= form.check_box :id,:size => 3 %><%= form.hidden_field :id,:size => 3 %><%=@products[enum].cn_name %></td>
		 <td style="text-align: left;"><%=@products[enum].en_name %></td>
		<td style="text-align: left;"><%= form.text_field :total_amount,:size => 5,:value =>0 %></td>
		 <td style="text-align: left;"><%= form.text_field :per_cost,:size => 5 %><%#=h @products[enum].per_cost %></td>
		<td style="text-align: left;"><%= form.text_field :total_price,:size => 5,:value =>0 ,:disabled => 'disabled'%></td>
		<td style="text-align: left;"><%= form.text_field :order_num,:size => 10 %></td>
		<td style="text-align: left;"><%= form.text_field :description,:size => 20 %></td>
		<% if @products[enum+1] %>
			<% i = @products[enum].category == @products[enum+1].category ? 0 : 1 %>

		<% end %>

	</tr>
			<% end %>
	<% end %>
                         <div style="margin: 15px;">
	<%= submit_tag "保 存" %>	
        </div>
	
<% end %>


